package coloring.checking;

import org.jgrapht.Graph;

import coloring.MyDefaultEdge;
import coloring.vertex.Vertex;

/**
 * Class for checking if graph is correctly colored
 * 
 * @author Croaker
 * 
 */
public class ColoringCheck {

	/**
	 * Return true if graph is correctly colored
	 * 
	 * @param graph
	 * @return
	 */
	public boolean check(Graph<Vertex, MyDefaultEdge> graph) {
		for (MyDefaultEdge defaultEdge : graph.edgeSet()) {
			if (defaultEdge.getSourseColor() == defaultEdge.getTargetColor()) {
				System.out.println("Graph isn't right colored!");
				System.out.println(defaultEdge);
				return false;
			}
		}
		return true;
	}
}
